g_error() as soon as we catch an invalid column type
authorFederico Mena Quintero <federico@novell.com>
Wed, 26 Aug 2009 23:38:03 +0000 (18:38 -0500)
committerBenjamin Otte <otte@gnome.org>
Thu, 15 Oct 2009 20:06:13 +0000 (22:06 +0200)
There's no point in running a GtkFileSystemModel with invalid column types.
This way we can also avoid clearing the memory of the column_types array.

Signed-off-by: Federico Mena Quintero <federico@novell.com>
gtk/gtkfilesystemmodel.c

index e2a7c4e54446421df0400441e9b6992a0b2ff058..db3fc56973e8f52bf6e07683b779d7bf60dc5589 100644 (file)
@@ -1090,6 +1090,7 @@ gtk_file_system_model_set_n_columns (GtkFileSystemModel *model,
   guint i;
 
   g_assert (model->files == NULL);
+  g_assert (n_columns > 0);
 
   model->n_columns = n_columns;
   model->column_types = g_slice_alloc0 (sizeof (GType) * n_columns);
@@ -1099,8 +1100,8 @@ gtk_file_system_model_set_n_columns (GtkFileSystemModel *model,
       GType type = va_arg (args, GType);
       if (! _gtk_tree_data_list_check_type (type))
        {
-         g_warning ("%s: Invalid type %s\n", G_STRLOC, g_type_name (type));
-          continue;
+         g_error ("%s: type %s cannot be a column type for GtkFileSystemModel\n", G_STRLOC, g_type_name (type));
+          return; /* not reached */
        }
 
       model->column_types[i] = type;